#@adminLayout() #define main()
<link href="#(ctx)/static/ajax/libs/bootstrap-fileinput/fileinput.min.css?v=5.2.4" rel="stylesheet"/>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>单文件上传</h5>
                    </div>
                    <div class="ibox-content">
                    	<div class="form-group">
                            <label class="font-noraml">单文件上传</label>
	                        <div class="file-loading">
					            <input id="singleFile" name="file" type="file">
					        </div>
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
<script src="#(ctx)/static/ajax/libs/bootstrap-fileinput/fileinput.min.js?v=5.2.4"></script>
	<script type="text/javascript">
	var m_id="#(m_id)";
	var cdoc_type="#(cdoc_type)";
		var prefix="#(ctx)/sysfile";
		$(document).ready(function () {
	    	// 单图上传
	    	$("#singleFile").fileinput({
	            uploadUrl: prefix + '/uploadSingle',
	            maxFileCount: 1,
	            autoReplace: true,
	            uploadExtraData : function() {// 向后台传递参数
	    			var data = {
	    				m_id : m_id,
	    				cdoc_type : cdoc_type
	    			};
	    			return data;
	    		}
	        }).on('fileuploaded', function (event, data, previewId, index) {
	        	var rsp = data.response;
	            log.info("return url：" + rsp.url)
	            log.info("reutrn fileName：" + rsp.fileName)

	            if(window.parent.refresh)
	            {
	                window.parent.refresh();
	            }
	            
	        }).on('fileremoved', function (event, id, index) {
	            $("input[name='" + event.currentTarget.id + "']").val('')
	        }).on('fileerror',function(event,data){
	        	$.modal.alertError("上传失败");
	    	})
	    });
	</script>
</body>
#end
